package edu.yctc.delivery.exception;

/**
 * 
 * @className DeliveryException
 * @description 自定义异常类
 * @author zyj
 * @date 2020年1月16日
 *
 */
public class DeliveryException extends RuntimeException {

    private static final long serialVersionUID = 1L;
    private int code;
    private String message;
    private Object data;

    public DeliveryException() {
        super();
    }

    public DeliveryException(int code, String message, Object data) {
        super();
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public DeliveryException(int code, String message) {
        this(code, message, null);
    }

    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("CICException [code=");
        builder.append(code);
        builder.append(", message=");
        builder.append(message);
        builder.append(", data=");
        builder.append(data);
        builder.append("]");
        return builder.toString();
    }

}
